import java.util.Scanner;
import java.util.Arrays;

public class AnagramChecker {

    public static final String USING_INPUT = "using input parameters ";
    public static final String INPUT = "Please, input the phrase ";
    public static final String THIS_PHRASES = "This phrases are anagrams - ";

    public static void main(String[] args) {
        if (args.length == 2) {
            System.out.println(USING_INPUT + args[0] + " " + args[1]);
            String argsString1 = args[0];
            String argsString2 = args[1];
            dataOut(argsString1, argsString2);
        } else {
            System.out.println(INPUT);
            String inputedString1 = getString();
            String inputedString2 = getString();
            dataOut(inputedString1, inputedString2);
        }
    }

    private static String getString() {
        Scanner input = new Scanner(System.in);
        String testString = input.nextLine();
        return testString;
    }

    private static void dataOut(String word, String anagram) {
        char[] charFromWordOne = getChars(word);
        char[] charFromWordTwo = getChars(anagram);
        System.out.println(THIS_PHRASES + Arrays.equals(charFromWordOne, charFromWordTwo));
    }

    private static char[] getChars(String word) {
        char[] newChar = word.toLowerCase().replaceAll("\\s", "").toCharArray();
        Arrays.sort(newChar);
        return newChar;
    }
 }
